package com.example.lyqwork.exception;

import com.example.lyqwork.pojo.ResponseMessage;
import jakarta.servlet.http.HttpServletRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;


@RestControllerAdvice
public class GlobalExceptionHandlerAdvice {
    Logger log = LoggerFactory.getLogger(GlobalExceptionHandlerAdvice.class);
    @ExceptionHandler({Exception.class}) //
    public ResponseMessage handleException(Exception e, HttpServletRequest request)
    {

        log.error("统一异常",e);
        return new ResponseMessage(500,"error",null);
    }
}
